# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=librespot
_sha=a4e0f582a8c705b05c8abba58d9e9c1c06ad532d
pkgver=20180817
pkgrel=1
pkgdesc="Open Source Spotify client library"
url="https://github.com/librespot-org/librespot"
arch="x86_64"
license="MIT"
depends=""
makedepends="cargo portaudio-dev alsa-lib-dev"
install="$pkgname.pre-install"
subpackages=""
source="librespot-$pkgver.tar.gz::https://github.com/librespot-org/librespot/archive/$_sha.tar.gz
	$pkgname.initd
	$pkgname.confd
	"
builddir="$srcdir/librespot-$_sha"

build() {
	cd "$builddir"
	export CARGO_HOME="$srcdir"/cargo
	export RUSTFLAGS="-C target-feature=-crt-static"
	cargo build \
		--release \
		--verbose \
		--features alsa-backend
}

package() {
	cd "$builddir"
	install -Dm755 target/release/librespot "$pkgdir"/usr/bin/librespot
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="5f32dd244ccefd257b17c3a7b736274c9e5b6b23db9df973a07c7ee93d4a1c7d8d11fc12a41314306fe26bea93ec2312f8c75b3975aba5372c3dc77642ab9325  librespot-20180817.tar.gz
c48ea30e2bd076691a2f1e0e3f6c6329921a8cf25e4f39ca82e07aca5a1c2c519007f081f2b6bbd1566086407a52dce787450b840e8a07e3010227cefda0452a  librespot.initd
4286a3d1cc9678af2f43074c30a0ab7a9f686301468a0fd435d37a62773f0d1501b7201851bef4237324a83361ad93531ceb512a42ee0a63d4d14677760f5ec5  librespot.confd"
